home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 4 / Precision Software Applications Silver Collection Volume 4 (1993).iso / stats / chadyn.exe / YSCREEN.C < prev    next >
Text File  |  1988-12-10  |  3KB  |  131 lines

  1.  
  2. /********************************* YSCREEN.C *********************************/
  3. /********************* (C) 1986,7,8 by JAMES A. YORKE ************************/
  4.  
  5. /* Some of the Desmet compiler elements of this file were written 
  6.         by Robert Buchal        */
  7.  
  8.  
  9. /*      DX is a register used by MUL and DIV                 */
  10. /*    AH is the high byte of AX; AL is the low byte */
  11. /* MOV moves 00000H  to DX in bprint */
  12. /* INT causes an interrupt */
  13.  
  14.  
  15. /*********************************************/
  16. #include "yinclud.h"
  17.  
  18.  
  19.  
  20.  
  21. #ifndef MAINFRAME
  22.  
  23. #ifdef MS
  24. #include <dos.h>        /* for int86 */
  25. #include <graph.h>        /* graphics include file; see p81 MS Quick C
  26.                    Prog. Guide */
  27.  
  28. int     set_mode(void);    /* prototype */
  29. struct videoconfig      vc;    /* configuration data */
  30.  
  31. SetVidMode() {            /* called in YFETCH.C and also below */
  32.     if(set_mode () == 0) {
  33.         printf("You have no identifiable graphics board.\n");
  34.         printf(
  35.                 "If you have a Hercules compatible graphics board, you must run the program \n"
  36.             );
  37.         printf(
  38.                 "MSHERC before running DYNAMICS. MSHERC is on the DYNAMICS distribution disk."
  39.             );
  40.         printf("\n\n");
  41.         exit(0);
  42.     }
  43.     else
  44.         _getvideoconfig(&vc);/* put videoconfig data in vc */
  45. }
  46.  
  47. int     set_mode() {
  48.     if(_setvideomode (_HERCMONO)) {
  49.             scrnrows = 348;
  50.         scrncols = 720;
  51.         numColors = 2;
  52.         return(_HERCMONO);/* 720X348 Hecules board */
  53.     }
  54.     if(_setvideomode (_VRES16COLOR)) {
  55.         scrnrows = 480;
  56.         scrncols = 640;
  57.         _setcolor((color = 3));
  58.                 /* in monocrome this is fairly visible */
  59.         numColors = 16;
  60.         return(_VRES16COLOR);/* 640 X 480 16 color */
  61.     }
  62.     if(_setvideomode (_VRES2COLOR)) {
  63.         scrnrows = 480;
  64.         scrncols = 640;
  65.         numColors = 2;
  66.         return(_VRES2COLOR);/* 640 X 480 2 color */
  67.     }
  68.     if(_setvideomode (_ERESCOLOR)) {
  69.         scrnrows = 350;
  70.         scrncols = 640;
  71.         _setcolor((color = 12));/* 12 = light red */
  72. /* doesn't work:_setbkcolor(one);This sets the background color; the command 
  73.           "BLACK" sets the background back to black; "setbkcolor" sets 
  74.            the background color; 1 = blue */
  75.         numColors = 16;
  76.         return(_ERESCOLOR);/* 640X350 COLOR: VGA or EGA */
  77.     }
  78.     if(_setvideomode (_ERESNOCOLOR)) {
  79.         scrnrows = 350;
  80.         scrncols = 640;
  81.         numColors = 2;
  82.         return(_ERESNOCOLOR);/* 640X350 BW: VGA or EGA */
  83.     }
  84.     if(_setvideomode (_HRESBW)) {
  85.         scrnrows = 200;
  86.         scrncols = 640;
  87.         numColors = 2;
  88.         return(_HRESBW);/* 640X200 BW: VGA, EGA, or CGA */
  89.     }
  90.     return(0);
  91. }
  92.  
  93. int     colorGraphics() {    /* called using command "color" */
  94.  
  95.     if(_setvideomode (_MRES256COLOR)) {
  96.                 scrnrows = 200;
  97.         scrncols = 320;
  98.         numColors = 256;
  99.         return(_MRES256COLOR);/* 320 X 200,256 color,VGA or EGA */
  100.     }
  101.     if(_setvideomode (_MRES4COLOR)) {
  102.                 /* =  4    means 320 x 200, 4 color */
  103.         scrnrows = 200;
  104.         scrncols = 320;
  105.         _setcolor((color = 1));
  106.         numColors = 4;
  107.         return(_ERESNOCOLOR);/* 640X350 BW: VGA or EGA */
  108.     }
  109.     return(0);
  110. }
  111.  
  112.  
  113. character_mode() {        /* see command "XX" */
  114. /*    _setvideomode(_DEFAULTMODE);*/
  115.     union REGS regs;    /* for int86 use */
  116.  
  117.     regs.h.ah = 0;
  118.     regs.h.al = 2;
  119.     regs.x.dx = 0;
  120.     int86 (16, ®s, ®s);/* BIOS interrupt 10H; */
  121.     return;
  122. }
  123.  
  124.  
  125. #endif                /* end #ifdef MS */
  126. /************************/
  127. #endif /* ifndef MAINFRAME */
  128.  
  129.  
  130.  
  131.